package com.shanzmoo.db.product.entity.vo;

import com.shanzmoo.db.product.entity.ProductSkuEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.math.BigDecimal;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@ApiModel("sku详情")
public class ProductSkuInfoVO implements Serializable {
    private static final long serialVersionUID = 1758L;

    @ApiModelProperty("sku")
    private String sku;

    @ApiModelProperty("销售价格")
    private BigDecimal retailPrice;

    @ApiModelProperty("原价")
    private BigDecimal marketPrice;

    @ApiModelProperty("规格属性")
    private String attribute;

    @ApiModelProperty("库存")
    private Integer availableStockNum;

    public static ProductSkuInfoVO create(ProductSkuEntity skuEntity) {
        return ProductSkuInfoVO.builder()
                .sku(skuEntity.getSku())
                .retailPrice(skuEntity.getRetailPrice())
                .marketPrice(skuEntity.getMarketPrice())
                .attribute(skuEntity.getAttributeDesc())
                .availableStockNum(skuEntity.getAvailableStockNum())
                .build();
    }
}
